<template>
	<view class="centTent">
		<view class="CA-cent">
			<view class="">
				账号注销须知
			</view>
			<view class="">
				1:注销成功后您将无法登录，使用、找回或者处置该账号，您将丢失该账号下的订单、收益等所有相关信息，请谨慎操作。
			</view>
			<view class="">
				2:注销账号为不可恢复操作，您的全部账户信息将永久删除且无法恢复
			</view>
		</view>

		<button class="shop-btn" type="success" @click="onDetailUser" :disabled="loading"
			:loading="loading">同意须知，确定要注销</button>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from "vuex"

	import {
		deleteUser
	} from "@/api/apis.js";
	export default {
		data() {
			return {
				loading: false,
			};
		},
		computed: {
			...mapState("userInfo", ["Info", 'storeId', 'storeForm']),
		},
		methods: {
			...mapMutations("userInfo", ['setRemove']),
			onDetailUser() {
				let params = {
					mobile: this.Info.mobile
				}
				let that = this
				uni.showModal({
					title: '提示：',
					content: '请确认是否要注销用户？',
					cancelColor: "#aaaaaa",
					confirmColor: "#FE2C55",
					success: (res) => {
						if (res.confirm) {
							deleteUser(params).then(res => {
								that.setRemove() //清空缓存信息
								uni.switchTab({
									url: '/pages/index/index'
								})
							})
						} else if (res.cancel) {
							// console.log('取消');
							//TODO
							return
						}
					}
				});

			},

		}
	}
</script>

<style lang="scss" scoped>
	.centTent {
		width: 100%;
		box-sizing: border-box;
		padding: 24rpx;
	}

	.CA-cent {
		font-size: 28rpx;
		box-sizing: border-box;
		padding: 24rpx;
		background-color: #fff;
		border-radius: 12rpx;
	}


	.shop-btn {
		position: fixed;
		bottom: 6%;
		left: calc(50% - 350rpx);
		width: 700rpx;
		height: 80rpx;
		line-height: 80rpx;
		background: linear-gradient(to right, #f21a1a, #ff7535);
		color: #fff;
		border-radius: 40rpx;
		font-size: 30rpx;
		margin: 50rpx auto;
	}
</style>